package com.credithc.customers.base.ro;

import com.credithc.customers.base.utils.CustomerUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

/**
 * @author zhukai
 * @date 2018/11/30 11:13
 */
@Data
public class CustomerContactModifyRo extends CustomerBaseRo {

    private String customerNo;

    private String contactTypeOld;

    private String contactInfoOld;

    private String contactType;

    private String contactInfo;

    private Boolean contactVerified;

    public static void checkBaseParam(CustomerContactModifyRo ro) {
        CustomerUtils.checkRequestNo(ro.getRequestNo());
        CustomerUtils.checkCustomerNo(ro.getCustomerNo());
        CustomerUtils.checkContactType(ro.getContactType());
        CustomerUtils.checkContactInfo(ro.getContactInfo());
        //若传了旧联系方式 则校验，没传不校验
        CustomerUtils.checkContact(ro.getContactType(), ro.getContactInfo());
        if (StringUtils.isNotBlank(ro.getContactTypeOld())) {
            CustomerUtils.checkContactType(ro.getContactTypeOld());
            if (StringUtils.isNotBlank(ro.getContactInfoOld())) {
                CustomerUtils.checkContact(ro.getContactTypeOld(), ro.getContactInfoOld());
            }
        }
    }
}
